﻿@{
    ViewBag.Title = "Mobiles";
    ViewBag.BackUrl = Url.Action("Mobilephones", "Product");
    LineFocus.Nikcron.Models.Lookup Manufactures = ViewBag.Manufactures;
}
@model Nickron.Database.Mobile

@using (Html.BeginForm("MobilephoneMaintenance", "Product", FormMethod.Post, new { onsubmit = "return ValidateForm();" }))
{

    <div class="col-md-6">
        <div class="box box-danger">
            <div class="box-body">

                <div class="box-header">
                    <h3 class="box-title">GENERAL FEATURE</h3>
                </div>

                <div class="form-group">
                    <label>Product Date:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class="fa fa-calendar"></i>
                        </div>
                        <input name="ProductDate" id="ProductDate" type="text" data-mask="" data-inputmask="'alias': 'dd/mm/yyyy'" class="form-control">
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>In The Box:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="InBox" name="InBox" type="text" maxlength="1000" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Model Number:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="ModelNumber" name="ModelNumber" type="text" maxlength="200" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Model Name:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="ModelName" name="ModelName" type="text" maxlength="500" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Manufacture:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <select id="Manufacture" name="Manufacture" class="selectpicker" title="Select Manufacture">
                            @Html.Partial("Dropdown", Manufactures)
                        </select>
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Form Factor:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <select id="FormFactor" name="FormFactor" class="form-control">
                            <option value="0">---Select---</option>
                            <option value="1">Bar</option>
                            <option value="2">Square</option>
                        </select>
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Call Features:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="CallFeatures" name="CallFeatures" type="text" maxlength="40" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>SIM Size:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="SimSize" name="SimSize" maxlength="20" type="text" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>SIM Type:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="SimType" name="SimType" maxlength="20" type="text" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">CAMERA</h3>
                </div>

                <div class="form-group">
                    <label>Primary Camera:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="PrimaryCamera" name="PrimaryCamera" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Secondary Camera:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="SecondryCamera" name="SecondryCamera" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Video Recording:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="VideoRecording" name="VideoRecording" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">DIMENTIONS</h3>
                </div>

                <div class="form-group">
                    <label>Size:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="Dimension" name="Dimension" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Weight:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="Weight" name="Weight" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">BATTERY</h3>
                </div>

                <div class="form-group">
                    <label>Type:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="BatteryType" name="BatteryType" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Standby Time:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="BatteryStandBy" name="BatteryStandBy" type="number" maxlength="20" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Battery Capacity:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="BatteryCapacity" name="BatteryCapacity" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">MULTIMEDIA</h3>
                </div>

                <div class="form-group">
                    <label>Music Player:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="MusicPlayer" name="MusicPlayer" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Video Player:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="VideoPlayer" name="VideoPlayer" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Sound Enhancement:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="SoundEnhancement" name="SoundEnhancement" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Ringtone:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="RingTone" name="RingTone" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>FM:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <select id="FM" name="FM" class="form-control">
                            <option value="0">---Select---</option>
                            <option value="1">Yes</option>
                            <option value="2">No</option>
                        </select>
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">WARRANTY</h3>
                </div>

                <div class="form-group">
                    <label>Warranty Summary:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <textarea id="WarrantySummary" name="WarrantySummary" maxlength="1000" class="form-control pull-right"></textarea>
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

            </div><!-- /.box-body -->
        </div><!-- /.box -->

    </div><!-- /.col (left) -->

    <div class="col-md-6">

        <div class="box box-primary">

            <div class="box-body">

                <div class="box-header">
                    <h3 class="box-title">Platform</h3>
                </div>

                <div class="form-group">
                    <label>Operating Freq:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="OperatingFrequencies" name="OperatingFrequencies" type="text" maxlength="60" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>OS:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="OperatingSystem" name="OperatingSystem" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>RAM:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="Processor" name="Processor" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">Display</h3>
                </div>

                <div class="form-group">
                    <label>Type:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="DisplayType" name="DisplayType" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Size:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="DisplaySize" name="DisplaySize" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Resolution:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="DisplayResolution" name="DisplayResolution" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title"> MEMORY AND STORAGE</h3>
                </div>

                <div class="form-group">
                    <label>ROM:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="InternalStorage" name="InternalStorage" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Expandable Memory:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="ExternalStorage" name="ExternalStorage" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Phone Book Memory:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="PhoneMemory" name="PhoneMemory" type="text" maxlength="20" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title"> INTERNET & CONNECTIVITY</h3>
                </div>

                <div class="form-group">
                    <label>Internet Features:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="InternetFeatures" name="InternetFeatures" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Preinstalled Browser:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="PreinstalledBrowser" name="PreinstalledBrowser" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>GPRS:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="GPRS_2G" name="GPRS_2G" type="text" maxlength="60" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>3G:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="HSPA_3G" name="HSPA_3G" type="text" maxlength="60" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>EDGE_2G:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="EDGE_2G" name="EDGE_2G" type="text" maxlength="60" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Wifi:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="WiFi" name="WiFi" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Tethering:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="Hotspot" name="Hotspot" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>USB Connectivity:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="USB" name="USB" type="text" maxlength="60" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Bluetooth:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="Bluetooth" name="Bluetooth" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Supported Networks:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="SupportedNetworks" name="SupportedNetworks" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">OTHER FEATURES</h3>
                </div>

                <div class="form-group">
                    <label>Note:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <textarea id="NoteSummary" name="NoteSummary" maxlength="1000" class="form-control pull-right"></textarea>
                    </div><!-- /.input group -->
                </div><!-- /.form group -->
                
                <div class="form-group">
                    <label>MRP:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="MRP" name="MRP" type="number" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box box-success">
                    <div class="box-footer">
                        <input type="hidden" name="Id" id="Id" value="@ViewBag.Id" />
                        <button type="submit" class="btn btn-primary" style=" width:80px;">Save</button>
                        <button type="reset" class="btn btn-primary" onclick="GoBackListing()" style=" width:80px;">Cancel</button>
                    </div>
                </div><!-- /.box -->

            </div><!-- /.box-body -->
        </div><!-- /.box -->

    </div><!-- /.col (right) -->

    <script>

        function GoBackListing() {
            window.location.replace('@Url.Action("Laptops","Product",null)');
        }
        function ValidateForm() {
            RequiredTextbox("ModelNumber", "Enter the Model Number")
            RequiredTextbox("ModelName", "Enter the Model Name")
            RequiredDropdown("Manufacture", -1, "Select a Manufacture");
            RequiredTextbox("CallFeatures", "Enter the Call Features")
            RequiredTextbox("SimSize", "Select the SimSize")
            RequiredTextbox("SimType", "Enter the SimType")
            RequiredTextbox("PrimaryCamera", "Enter the Primary Camera")
            RequiredTextbox("Dimension", "Enter the Dimention Size")
            RequiredTextbox("Weight", "Enter the Dimention Weight")
            RequiredTextbox("BatteryCapacity", "Enter the Battery Capacity")
            RequiredTextbox("MusicPlayer", "Enter the Music Player")
            RequiredTextbox("WarrantySummary", "Enter the Warranty Summary")
            RequiredTextbox("OperatingSystem", "Enter the Operating System")
            RequiredTextbox("Processor", "Enter the RAM")
            RequiredTextbox("InternalStorage", "Enter the ROM")
            RequiredTextbox("ExternalStorage", "Enter the Expandable Memory")
            RequiredTextbox("MRP", "Enter MRP");
            return AlertError();
        }
        @*function LoadManufactures()
        {
            $.getJSON("@Url.Action("GetLookups", "Master", new { LookupType = "Manufacture" })", function (result) {
                var options = '';
                $.each(result, function (item) {
                    options += '<option value="' + result[item].Id + '">' + result[item].Name + '</option>';
                });
                $("select#Manufacture").html(options);
            });
        }

        function GoBackListing() {
            window.location.replace('@Url.Action("Mobilephones","Product",null)');
        }*@

        $(function () {
            $('#BatteryStandBy').keydown(function (e) {
                if (e.shiftKey || e.ctrlKey || e.altKey) {
                    e.preventDefault();
                } else {
                    var key = e.keyCode;
                    if (!((key == 8) || (key == 46) || (key >= 35 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105))) {
                        e.preventDefault();
                    }
                }
            });
        });


        $(document).ready(function () {
            $('.selectpicker').selectpicker();
            $('#ProductDate').datepicker();
            //LoadManufactures();
            if ("@ViewBag.Id" != "0")
            {
                $('#Id').val('@Model.Id');
                $('#Manufacture').selectpicker("val", "@Model.ManufactureId");
                $('#ProductDate').val('@Model.ProductDate');
                $('#InBox').val('@Model.InBox');
                $('#ModelNumber').val('@Model.ModelNumber');
                $('#ModelName').val('@Model.ModelName');
                $('#FormFactor').val('@Model.FormFactor');
                $('#CallFeatures').val('@Model.CallFeatures');
                $('#SimSize').val('@Model.SimSize');
                $('#SimType').val('@Model.SimType');
                $('#PrimaryCamera').val('@Model.PrimaryCamera');
                $('#SecondryCamera').val('@Model.SecondryCamera');

                $('#VideoRecording').val('@Model.VideoRecording');
                $('#Dimension').val('@Model.Dimension');
                $('#Weight').val('@Model.Weight');
                $('#BatteryType').val('@Model.BatteryType');
                $('#BatteryStandBy').val('@Model.BatteryStandBy');
                $('#BatteryCapacity').val('@Model.BatteryCapacity');
                $('#MusicPlayer').val('@Model.MusicPlayer');
                $('#VideoPlayer').val('@Model.VideoPlayer');
                $('#SoundEnhancement').val('@Model.SoundEnhancement');
                $('#RingTone').val('@Model.RingTone');
                $('#FM').val('@Model.FM');

                $('#WarrantySummary').val('@Model.WarrantySummary');
                $('#OperatingFrequencies').val('@Model.Connectivity.OperatingFrequencies');
                $('#OperatingSystem').val('@Model.OperatingSystem');
                $('#Processor').val('@Model.Processor');
                $('#DisplayType').val('@Model.DisplayType');
                $('#DisplaySize').val('@Model.DisplaySize');
                $('#DisplayResolution').val('@Model.DisplayResolution');
                $('#InternalStorage').val('@Model.InternalStorage');
                $('#ExternalStorage').val('@Model.ExternalStorage');
                $('#PhoneMemory').val('@Model.PhoneMemory');
                $('#InternetFeatures').val('@Model.InternetFeatures');
                $('#PreinstalledBrowser').val('@Model.PreinstalledBrowser');
                $('#HSPA_3G').val('@Model.Connectivity.HSPA_3G');
                $('#GPRS_2G').val('@Model.Connectivity.GPRS_2G');
                $('#EDGE_2G').val('@Model.Connectivity.EDGE_2G');
                $('#WiFi').val('@Model.WiFi');
                $('#Hotspot').val('@Model.Connectivity.Hotspot');
                $('#USB').val('@Model.Connectivity.USB');
                $('#Bluetooth').val('@Model.Connectivity.Bluetooth');
                $('#SupportedNetworks').val('@Model.Connectivity.SupportedNetworks');
                $('#NoteSummary').val('@Model.NoteSummary'.replace("&lt;br/&gt;", "\r\n"));
                $('#MRP').val('@Model.MRP.Amount.Value.ToString("f2")');
            }
            else
            {
                $('#Manufacture')[0].selectedIndex = -1;
                $('*[data-id="Manufacture"]').prop("title", "");
                $('*[data-id="Manufacture"]').html('<span class="filter-option pull-left" />&nbsp;<span class="caret" />');
            }

        });
    </script>

}
